import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    component: () => import('@/views/login'),
    name: 'login'
  },
  {
    path: '/',
    component: () => import('@/views/layout'),
    children: [
      {
        path: '',//默认路由 --首页
        component: () => import('@/views/home'),
        name: 'home',
      },
      {
        path: 'my',
        component: () => import('@/views/my'),
        name: 'my',
      },
      {
        path: 'qa',
        component: () => import('@/views/qa'),
        name: 'qa',
      },
      {
        path: 'video',
        component: () => import('@/views/video'),
        name: 'video',
      },
    ]

  },
  {
    path: '/search',
    name: 'search',
    component: () => import('@/views/search')
  },
  {
    path:'/article/:articleId',
    name:'article',
    component:() => import('@/views/article'),
    // 开启路由传参
    props:true
    
  },
  // 用户个人信息
  {
    path: '/user/profile',
    name: 'user-profile',
    component: () => import('@/views/user-profile')
  }
]

const router = new VueRouter({
  routes
})

export default router
